/*
 * 2.2.cpp
 *
 *  Created on: 2012-5-16
 *      Author: jawinton
 */


#include <iostream>
#include <stdlib.h>

using namespace std;

#define SIZE 3

int main (void) {
	int n;
	cin >> n;
	while (n--) {
		char start[SIZE], end[SIZE];
		cin >> start >> end;
		int cols = abs(start[0] - end[0]);
		int rows = abs(start[1] - end[1]);

		if (cols ==0 && rows == 0) {
			cout << "0 0 0 0" << endl;
			continue;
		}

		//king steps
		cout << max(cols, rows) << " ";

		//queen steps
		if (cols == 0 || rows == 0 || cols ==  rows)
			cout << "1 ";
		else
			cout << "2 ";

		//rook steps
		if (cols == 0 || rows == 0)
			cout << "1 ";
		else
			cout << "2 ";

		//bishop steps
		if (cols == rows)
			cout << "1";
		else if ((int)abs(cols-rows) % 2 == 0)
			cout << "2";
		else
			cout << "Inf";
		cout << endl;
	}
	return 0;
}
